Find the number of zeros at the end of a factorial¶
Fnd the number of zeros at the end of a factorial
of a given positive number.
Range of the number(N): (1 = N = 2*109).
def fact_end_zero(N):
x = N // 5
y = x
while x > 0:
x /= 5
y += int(x)
return y
print(fact_end_zero(5))
print(fact_end_zero(12))
print(fact_end_zero(100))
Output:
1
2
24